package com.action.library;

import com.bean.library.Paper;
import com.dao.DaoManager;
import com.dao.library.PaperDao;

public class GeneratePaperRandomly {
	public Paper generatePaperRandomly(String subjectId,
			Integer[] problemCountEachDifficulty){
		DaoManager dm = DaoManager.getInstance();
		PaperDao paperDao = dm.getDao(PaperDao.class);
		Paper paper=null;
		try
		{
			dm.begin();
			paper = paperDao.getPaperRandomly(subjectId, problemCountEachDifficulty);
			dm.commit();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		finally 
		{
			dm.end();
		}
		return paper;
	}
}
